package frank.zou.study.testng.setup;

import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterGroups;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import frank.zou.study.testng.exceptions.Hello;

public class SetupTest2 {

	@BeforeSuite
	public void beforeSuite() { 
		System.out.println("SetupTest2: before suite.");
	}
	
	@AfterSuite
	public void afterSuite() { 
		System.out.println("SetupTest2: after suite.");
	}	
	
	@BeforeGroups(groups = {"setupGroup1"})
	public void beforeGroups() { 
		System.out.println("SetupTest2: before group 1.");
	}

	@AfterGroups(groups = {"setupGroup1"})
	public void afterGroups() { 
		System.out.println("SetupTest2: after group 1.");
	}

	@BeforeGroups(groups = {"setupGroup2"})
	public void beforeGroups2() { 
		System.out.println("SetupTest2: before group 2.");
	}

	@AfterGroups(groups = {"setupGroup2"})
	public void afterGroups2() { 
		System.out.println("SetupTest2: after group 2.");
	}	
	
	@BeforeClass
	public void beforeClass() { 
		System.out.println("SetupTest2: before class.");
	}

	
	
	@AfterClass
	public void afterClass() { 
		System.out.println("SetupTest2: after class.");
	}

	@BeforeTest
	public void beforeTest() { 
		System.out.println("SetupTest2: before test.");
	}	

	@AfterTest
	public void afterTest() { 
		System.out.println("SetupTest2: after test.");
	}	

	@BeforeMethod
	public void beforeMethod() { 
		System.out.println("SetupTest2: before method.");
	}	

	@AfterMethod
	public void afterMethod() { 
		System.out.println("SetupTest2: after method.");
	}			
	
	@Test(groups = {"setupGroup1"})
	public void testHello1() {
		System.out.println("SetupTest2.testHello1(...)");
		Hello hello = new Hello();
		Assert.assertEquals("hello", hello.hello(), "should say 'hello'.");
	}

	@Test(groups = {"setupGroup2"})
	public void testHello2() { 
		System.out.println("SetupTest2.testHello2(...)");
		Hello hello = new Hello();
		Assert.assertEquals("hello", hello.hello(), "should say 'hello' fir 2bd time.");
	}

}
